package com.example.jeecgboot.controller;

import com.example.jeecgboot.entity.UserEntity;
import com.example.jeecgboot.service.UserService;
import jakarta.annotation.Resource;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @version: java version 23
 * @Author: 韩学新
 * @description: * @date: 2025-05-22 下午1:24
 */
@RestController
public class UserController {

    @Resource
    private UserService userService;

    /**
     * 注解方式
     * 单引号表示字符串
     * key = "'findAll'"
     */
    @GetMapping("/findAll")
    @Cacheable(cacheNames = "users",key = "'findAll'")
    public List<UserEntity> findAll() {
        return userService.findAll();
    }

}
